//
//  TMGProductDataController.m
//  TMGold
//
//  Created by Mac on 2018/3/14.
//  Copyright © 2018年 tangmu. All rights reserved.
//

#import "TMGProductDataController.h"

@implementation TMGProductDataController
+ (void)sendPeopleAllNumWithGid:(NSString*)gid handle:(void(^)(NSString * num))handle{
    NSMutableDictionary * dic = [NSMutableDictionary new];
    NSString * url = [NSString stringWithFormat:@"%@%@",service_header,@"/gold/public/api/goods/buyGoodsTotal"];
    if ([STUserManger defult].userID.length) {
        [dic setObject:[STUserManger defult].userID forKey:@"uid"];
    }
    if ([STUserManger defult].token.length) {
        [dic setObject:[STUserManger defult].token forKey:@"token"];
    }
    if (gid.length) {
        [dic setObject:gid forKey:@"gid"];
    }
    [[STNetWrokManger defaultClient] requestWithPath:url
                                              method:STHttpRequestTypePost
                                          parameters:dic
                                             success:^(NSURLSessionDataTask *operation, id responseObject) {
                                                 NSString * num = responseObject[@"data"][@"number"];
                                                 if (handle) {
                                                     handle(num);
                                                 }
                                                 
                                             } failure:^(NSString *stateCode, STError *error) {

                                                 if (handle) {
                                                     handle(@"");
                                                 }
                                                 [SVProgressHUD showErrorWithStatus:error.desc];
                                             }];
}
@end
